import request from 'lib/request';

// 获取舌象列表
export function queryTongueList() {
  return request("wechat/tongue/list",{
    method: "GET",
  })
}

// 舌镜详情
export function queryTongueDetail(id) {
  let body= {
    id
  }
  return request("wechat/tongue/detail?"+"id="+id, { 
    method: "GET",
  })
}

// 删除舌镜记录
export function deleteTongueById(id) {
  const body = new FormData();
  body.append('id', id);
  return request.post('wechat/tongue/remove', { body });
}

// 保存智能舌镜结果
// res: { TongueId }
export function saveTongue(id, patientId, sheSe, bianJianHong, yuBanYuDian, taiSe, houBao, ni, fu, taiBao, pangShou, chiHen, dianCi, lieWen, moistDry, toughTender, comment) {
  const body = new FormData();
  body.append('tongueId', id);
  body.append('patientId', patientId);
  body.append('sheSe', sheSe);
  body.append('bianJianHong', bianJianHong);
  body.append('yuBanYuDian', yuBanYuDian);
  body.append('taiSe', taiSe);
  body.append('houBao', houBao);
  body.append('ni', ni);
  body.append('fu', fu);
  body.append('taiBao', taiBao);
  body.append('pangShou', pangShou);
  body.append('chiHen', chiHen);
  body.append('dianCi', dianCi);
  body.append('lieWen', lieWen);
  body.append('moistDry', moistDry);
  body.append('toughTender', toughTender);
  body.append('comment', comment);
  return request.post('wechat/tongue/save', { body });
}

// 提交舌图 ，获取智能舌镜描点结果
export function saveTongueImage(mediaId, hospitalId) {
  const body = new FormData();
  body.append('mediaId', mediaId);
  body.append('hospitalId', hospitalId);
  return request.post('wechat/tongue/step1', { body });
}

// 提交描点后的 舌图 ，获取智能舌镜结果
// res: { TongueId: number, TongueCon: string, TongueConDetail: string }
export function saveTongueStep2(res) {
  const body = new FormData();
  body.append('pointValue',res.pointValue);
  body.append('fixPointValue',res.pointValue);
  body.append('fixPointNumber',res.pointNumber);
  body.append('pointNumber',res.pointNumber);
  body.append('imageId',res.imageId);
  body.append('outRect',res.outRect);
  body.append('tongueId',res.tongueId);
  return request.post('wechat/tongue/step2', { body });
}

